type envkeys = 'v1' | 'beta' | 'dev';

const apiPath: string = import.meta.env.VITE_APIPATH;
const host: string = import.meta.env.VITE_HOST;
const key: envkeys = import.meta.env.VITE_KEY;
const MODE: string = import.meta.env.MODE;
const ssoUrl: string = import.meta.env.VITE_SSOURL;
const nodeEnv: string = import.meta.env.VITE_NODE_ENV;
const ssrHost: string = import.meta.env.VITE_SSRHOST;
console.log(MODE);
// NODE_ENV 只用两个值 , 'development','production'
const config = {
	apiPath,
	host,
	local: MODE.includes('local'),
	key,
	uploadHost: 'https://upload.inmuu.com/' + key,
	ssoUrl,
	nodeEnv,
	ssrHost,
};

type extendsType = {
	appid: string;
	liveHost: string;
};

const env: Record<envkeys, extendsType> = {
	v1: {
		appid: 'wxfe86114b90dabec2',
		liveHost: 'https://live.inmuu.com',
	},
	beta: {
		appid: 'wxa994d05fc7373ea7',
		liveHost: 'https://beta.tuwenzhibo.com',
	},
	dev: {
		appid: 'wxa994d05fc7373ea7',
		liveHost: 'https://dev.tuwenzhibo.com',
	},
};

export default Object.assign(config, env[key]);
